// pages/student_list/student_list.js
Page({


  /**
   * Page initial data
   */
  data: {
    students:[
      {
        account: '16000',
        phone:'1518888'
      },{
        account: '16000',
        phone:'1518888'
      },{
        account: '16000',
        phone:'1518888'
      },{
        account: '16000',
        phone:'1518888'
      }
    ]

  },

  /**
   * Lifecycle function--Called when page load
   */
  onLoad(options) {
    // get all students
    var app =getApp()
    var that =this
    wx.request({
      url: app.globalData.baseUrl + '/user/getAll',
      method: 'post',
      data:{

      },
      success(res){
        if(res.data!= null){
          console.log('获取学生列表成功')
          that.setData({
            students: res.data
          })
          
        }
      }
    })

  },


  /**
   * Lifecycle function--Called when page is initially rendered
   */
  onReady() {

  },

  /**
   * Lifecycle function--Called when page show
   */
  onShow() {

  },

  /**
   * Lifecycle function--Called when page hide
   */
  onHide() {

  },

  /**
   * Lifecycle function--Called when page unload
   */
  onUnload() {

  },

  /**
   * Page event handler function--Called when user drop down
   */
  onPullDownRefresh() {

  },

  /**
   * Called when page reach bottom
   */
  onReachBottom() {

  },

  /**
   * Called when user click on the top right corner to share
   */
  onShareAppMessage() {

  },
  gotoStudent:function(e){
    // 设置session为当前学生的
    var cardNumber =e.currentTarget.dataset.word
    var localUserAccount = cardNumber; //记录登录用户
    wx.setStorageSync('localUserAccount', localUserAccount);
    wx.navigateTo({
      url: '../student/student',
    })
  }
})